<template>
  <div id="batchquery">
    <el-card class="box-card" style="margin:15px">
      <div style="margin-bottom:10px">
        <el-button size="small" type="primary" icon="el-icon-tickets" @click="getList(basicData)">刷新</el-button>
        <el-button size="small" type="danger" icon="el-icon-tickets" @click="clickRoll()">回退</el-button>
      </div>
      <el-table
        v-loading="loading"
        :data="tableData"
        style="width: 100%;padding:5px;"
        :header-cell-style="{
          background: '#333333',
          color: '#ffffff',
          textAlign: 'center'
        }"
        @selection-change="selectChanage"
      >
        <el-table-column align="center" type="selection" width="45" />
        <el-table-column align="center" prop="checkDate" label="操作">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="clickAudit(scope.row)">审核</el-button>
          </template>
        </el-table-column>
        <el-table-column align="center" prop="batchNumber" label="实验批号" width="150" />
        <el-table-column align="center" prop="swatchTime" label="布板日期" width="100">
          <template slot-scope="scope">
            <span>
              {{
              scope.row.swatchTime ? scope.row.swatchTime.substr(0, 10) : ""
              }}
            </span>
          </template>
        </el-table-column>
        <el-table-column align="center" prop="experimentCode.data" label="项目" />
        <el-table-column align="center" prop="qualityControl.data" label="质控品" />
        <el-table-column align="center" prop="reagent1.data" label="试剂1" />
        <el-table-column align="center" prop="reagent2.data" label="试剂2" />
        <el-table-column align="center" prop="sampleCount" label="样本数量" />
        <el-table-column align="center" prop="flowStatus.data" label="实验状态" />
      </el-table>
      <el-pagination
        :current-page="basicData.current"
        :page-size="basicData.size"
        :total="total"
        layout="slot, total, sizes, prev, pager, next, jumper"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      >
        <span
          v-if="tableData.length > 0"
          style="font-weight: 400;color:#606266"
        >已选中{{ selectList.length }}条，</span>
      </el-pagination>
    </el-card>

    <!-- 审核 -->
    <el-dialog
      width="85%"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      title="审核"
      :visible.sync="auditShow"
      append-to-body
    >
      <el-form ref="projectManageForm" :model="auditFormData" label-width="120px" size="small">
        <el-row style="margin-bottom:10px !important">
          <el-col :span="6">
            <el-form-item label="实验编号:">
              <el-input size="mini" v-model="queryData.expNum" placeholder="输入" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="母亲姓名:">
              <el-input size="mini" v-model="queryData.momName" placeholder="输入" />
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="实验结果:">
              <el-select v-model="queryData.experimentValueResult.key">
                <el-option
                  :label="item"
                  :value="key"
                  v-for="(item, key, index) in dicts.EXPERIMENT_RESULT"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-button
              size="mini"
              type="primary"
              @click="clickResult"
              style="margin-left:15px  !important;"
            >重置</el-button>
          </el-col>
        </el-row>
        <el-row>
          <el-table
            ref="dormitoryTable"
            row-key="sampleId"
            :data="tables"
            stripe
            style="width: 100%;color:#606266"
            :header-cell-style="{
              background: '#333333',
              color: '#ffffff',
              textAlign: 'center'
            }"
            class="import-table"
            :cell-style="tableRowStyle"
          >
            <el-table-column align="center" type="index" width="65" />
            <el-table-column align="center" label="实验编号" width="150" prop="expNum" />
            <el-table-column align="center" label="条形码号" width="150" prop="barCode" />
            <el-table-column align="center" label="采血日期" width="100" prop="bloodTime">
              <template slot-scope="scope">
                <span>
                  {{
                  scope.row.bloodTime ? scope.row.bloodTime.substr(0, 10) : ""
                  }}
                </span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="母亲姓名" prop="momName" />
            <el-table-column align="center" label="性别" prop="babySex.data" />
            <el-table-column align="center" label="出生日期" width="100" prop="birthTime">
              <template slot-scope="scope">
                <span>
                  {{
                  scope.row.birthTime ? scope.row.birthTime.substr(0, 10) : ""
                  }}
                </span>
              </template>
            </el-table-column>
            <el-table-column
              align="center"
              label="所属医院"
              prop="hospitalId.data.label"
              show-overflow-tooltip
            />
            <el-table-column align="center" label="实验项目" prop="experimentCode.data" />
            <el-table-column align="center" label="实验日期" width="100" prop="experimentDate">
              <template slot-scope="scope">
                <span>
                  {{
                  scope.row.experimentDate
                  ? scope.row.experimentDate.substr(0, 10)
                  : ""
                  }}
                </span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="实验结果" prop="experimentValueResult.data" />
            <el-table-column align="center" label="实验数据" prop="experimentValue">
              <template slot-scope="scope">
                <span
                  style="color: #1890ff;cursor: pointer;"
                  @click="clickSeeExpValue(scope.row.experimentValue)"
                >点击查看</span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="实验结论" prop="experimentResult.key" width="150">
              <template slot-scope="scope">
                <el-select
                  size="mini"
                  v-model="scope.row.experimentResult.key"
                  @change="tijiaoList[scope.$index].experimentResult.key = scope.row.experimentResult.key"
                  placeholder="实验结论"
                >
                  <el-option
                    v-for="(item, key, index) in dicts.EXPERIMENT_RESULT"
                    :key="index"
                    :label="item"
                    :value="key"
                  />
                </el-select>
              </template>
            </el-table-column>
            <el-table-column align="center" label="医嘱" prop="doctorAdvice" width="200">
              <template slot-scope="scope">
                <el-input
                  size="mini"
                  v-model="scope.row.doctorAdvice"
                  @change="tijiaoList[scope.$index].doctorAdvice = scope.row.doctorAdvice"
                  placeholder="输入"
                />
              </template>
            </el-table-column>
          </el-table>

          <el-row>
            <el-col :span="8">
              <el-form-item label="实验者:" prop="experimentResultMan">
                <el-input
                  size="mini"
                  style="width:300px"
                  v-model="auditFormData.experimentResultMan"
                  placeholder="输入"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="审核者:" prop="experimentCheckMan">
                <el-input
                  size="mini"
                  style="width:300px"
                  v-model="auditFormData.experimentCheckMan"
                  placeholder="输入"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="报告者:" prop="experimentReportMan">
                <el-input
                  size="mini"
                  style="width:300px"
                  v-model="auditFormData.experimentReportMan"
                  placeholder="输入"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="实验日期:" prop="experimentResultTime">
                <el-date-picker
                  size="mini"
                  v-model="auditFormData.experimentResultTime"
                  type="date"
                  style="width:300px"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="审核日期:" prop="experimentCheckTime">
                <el-date-picker
                  size="mini"
                  v-model="auditFormData.experimentCheckTime"
                  type="date"
                  style="width:300px"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="报告日期:" prop="experimentReportTime">
                <el-date-picker
                  size="mini"
                  v-model="auditFormData.experimentReportTime"
                  type="date"
                  style="width:300px"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期"
                />
              </el-form-item>
            </el-col>
          </el-row>
          <el-col :span="24">
            <div style="display:flex;widht:100%;justify-content: center;margin-top:10px">
              <el-button size="small" type="primary" @click="clickAuditSeav">保存</el-button>
            </div>
          </el-col>
        </el-row>
      </el-form>
    </el-dialog>

    <!-- 点击查看 -->
    <el-dialog width="65%" title="实验数据" :visible.sync="seeShow" append-to-body>
      <!-- 表格 -->
      <el-row style="line-height: 1.5;border:1px solid">
        <el-col
          :span="5"
          style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
        >筛查项目</el-col>
        <el-col
          :span="3"
          style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
        >检测指标</el-col>
        <el-col
          :span="3"
          style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
        >检测值</el-col>
        <el-col
          :span="5"
          style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
        >正常参考值</el-col>
        <el-col
          :span="8"
          style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;"
        >筛查结果</el-col>
        <!-- hint -->
      </el-row>
      <!-- 表格内容 -->
      <el-row
        style="line-height: 1.5;border-bottom:1px solid;border-left:1px solid;border-right:1px solid;"
      >
        <div v-for="(item, index) in seeData" :key="index">
          <el-col
            :span="5"
            :style="item.experimentValueResult != 'normal' ? 'background-color:#baccef;':''"
            style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
          >{{ item.indicatorCodeName }}&nbsp</el-col>
          <el-col
            :span="3"
            :style="item.experimentValueResult != 'normal' ? 'background-color:#baccef;':''"
            style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
          >{{ item.indicatorCode }}&nbsp</el-col>
          <el-col
            :span="3"
            :style="item.experimentValueResult != 'normal' ? 'background-color:#baccef;':''"
            style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
          >{{ item.experimentValue }}{{ item.units }}&nbsp</el-col>
          <el-col
            :span="5"
            :style="item.experimentValueResult != 'normal' ? 'background-color:#baccef;':''"
            style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
          >{{ item.referenceValue }}&nbsp</el-col>
          <el-col
            :span="8"
            :style="item.experimentValueResult != 'normal' ? 'background-color:#baccef;':''"
            style="display:flex;justify-content: center;color:#000000f2;font-size: 15px;border-right:1px solid"
          >{{ item.hint }}&nbsp</el-col>
        </div>
      </el-row>
    </el-dialog>

    <!-- 回退 -->
    <el-dialog
      width="85%"
      :close-on-press-escape="false"
      :close-on-click-modal="false"
      title="回退"
      :visible.sync="rollShow"
      append-to-body
    >
      <el-form ref="projectManageForm" :model="auditFormData" label-width="120px" size="small">
        <el-row>
          <el-table
            ref="dormitoryTable"
            row-key="sampleId"
            :data="auditList"
            stripe
            style="width: 100%;"
            :header-cell-style="{
              background: '#333333',
              color: '#ffffff',
              textAlign: 'center'
            }"
            class="import-table"
          >
            <el-table-column align="center" type="index" width="65" />
            <el-table-column align="center" label="实验编号" width="150" prop="expNum" />
            <el-table-column align="center" label="条形码号" width="150" prop="barCode" />
            <el-table-column align="center" label="采血日期" width="100" prop="bloodTime">
              <template slot-scope="scope">
                <span>
                  {{
                  scope.row.bloodTime ? scope.row.bloodTime.substr(0, 10) : ""
                  }}
                </span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="母亲姓名" prop="monName" />
            <el-table-column align="center" label="性别" prop="babySex.data" />
            <el-table-column align="center" label="出生日期" width="100" prop="birthTime">
              <template slot-scope="scope">
                <span>
                  {{
                  scope.row.birthTime ? scope.row.birthTime.substr(0, 10) : ""
                  }}
                </span>
              </template>
            </el-table-column>
            <el-table-column
              align="center"
              label="所属医院"
              prop="hospitalId.data.label"
              show-overflow-tooltip
            />
            <el-table-column align="center" label="实验项目" prop="experimentCode.data" />
            <el-table-column align="center" label="实验日期" width="100" prop="experimentDate">
              <template slot-scope="scope">
                <span>
                  {{
                  scope.row.experimentDate
                  ? scope.row.experimentDate.substr(0, 10)
                  : ""
                  }}
                </span>
              </template>
            </el-table-column>
            <el-table-column align="center" label="实验数据" prop="experimentValue">
              <template slot-scope="scope">
                <span
                  style="color: #1890ff;cursor: pointer;"
                  @click="clickSeeExpValue(scope.row.experimentValue)"
                >点击查看</span>
              </template>
            </el-table-column>
            <!-- <el-table-column align="center" label="实验结论" prop="experimentResult.key">
              <template slot-scope="scope">
                <el-select size="mini" v-model="scope.row.experimentResult.key" placeholder="实验结论">
                  <el-option
                    v-for="(item, key, index) in dicts.EXPERIMENT_RESULT"
                    :key="index"
                    :label="item"
                    :value="key"
                  />
                </el-select>
              </template>
            </el-table-column>
            <el-table-column align="center" label="医嘱" prop="doctorAdvice">
              <template slot-scope="scope">
                <el-input size="mini" v-model="scope.row.doctorAdvice" placeholder="输入" />
              </template>
            </el-table-column>-->
          </el-table>

          <el-row>
            <el-col :span="8">
              <el-form-item label="实验者:" prop="experimentResultMan">
                <el-input
                  size="mini"
                  style="width:300px"
                  v-model="auditFormData.experimentResultMan"
                  placeholder="输入"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="审核者:" prop="experimentCheckMan">
                <el-input
                  size="mini"
                  style="width:300px"
                  v-model="auditFormData.experimentCheckMan"
                  placeholder="输入"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="实验日期:" prop="experimentResultTime">
                <el-date-picker
                  size="mini"
                  v-model="auditFormData.experimentResultTime"
                  type="date"
                  style="width:300px"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期"
                />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="审核日期:" prop="experimentCheckTime">
                <el-date-picker
                  size="mini"
                  v-model="auditFormData.experimentCheckTime"
                  type="date"
                  style="width:300px"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期"
                />
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="回退原因:" prop="checkReason">
                <el-input size="mini" v-model="auditFormData.checkReason" placeholder="输入" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-col :span="24">
            <div style="display:flex;widht:100%;justify-content: center;margin-top:10px">
              <el-button size="small" type="primary" @click="clickRollback">保存</el-button>
            </div>
          </el-col>
        </el-row>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import DeliveryManageApi from "@/api/DeliveryManage.js";
import { initDicts } from "@/utils/commons";

export default {
  data() {
    return {
      // 转菊花
      loading: false,
      // 审核显示
      auditShow: false,
      // 点击查看
      seeShow: false,
      // 点击回退
      rollShow: false,
      // 审核提交数据
      auditFormData: {
        experimentCode: "",
        experimentSwatchId: "",
        list: [],
        experimentResultMan: this.$store.state.account.user.name,
        experimentCheckMan: this.$store.state.account.user.name,
        experimentReportMan: this.$store.state.account.user.name,
        experimentResultTime: "",
        experimentCheckTime: "",
        experimentReportTime: ""
      },
      checkReason: "",
      // 表格数据
      tableData: [],
      // 选中数据
      selectList: [],
      tijiaoList: [],
      total: 0,
      // 基本数据
      basicData: {
        current: 1,
        map: {},
        model: {
          batchNumber: "",
          experimentCode: {
            data: "",
            key: ""
          },
          flowStatus: {
            data: "",
            key: ""
          },
          qualityControl: "",
          reagent1: "",
          reagent2: "",
          swatchId: {
            key: ""
          },
          swatchMan: "",
          swatchTimeStartEnd: {
            end: "",
            start: ""
          }
        },
        order: "descending",
        size: 10,
        sort: "id"
      },
      // 同步数据表单
      syncData: {
        experimentCode: {
          key: ""
        },
        reportDate: {
          end: "",
          start: ""
        }
      },
      // 字典
      dicts: {
        EXPERIMENT_CODE: {}, //实验项目
        EXPERIMENT_RESULT: {} //实验结论
      },
      // 审核列表数据
      auditList: [],
      user: this.$store.state.account.user.name,
      seeData: [],
      queryData: {
        expNum: "",
        momName: "",
        experimentValueResult: {
          key: "",
          data: ""
        }
      }
    };
  },
  computed: {
    // 模糊搜索
    tables() {
      if (this.auditList.length > 0) {
        let dataList = JSON.parse(JSON.stringify(this.auditList));
        let queryList = [];
        if (this.queryData.expNum != "") {
          let i = 0;
          dataList.filter(data => {
            Object.keys(data).some(key => {
              if (key == "expNum") {
                if (
                  String(data[key])
                    .toLowerCase()
                    .indexOf(this.queryData.expNum) > -1
                ) {
                  queryList.push(data);
                  i++;
                }
              }
            });
          });
          if (i == 0) {
            this.$message.error("没有当前实验编号");
          }
        } else if (this.queryData.momName != "") {
          dataList.filter(data => {
            Object.keys(data).some(key => {
              if (key == "momName") {
                if (
                  String(data[key])
                    .toLowerCase()
                    .indexOf(this.queryData.momName) > -1
                ) {
                  queryList.push(data);
                }
              }
            });
          });
        } else if (this.queryData.experimentValueResult.key != "") {
          dataList.filter(data => {
            Object.keys(data).some(key => {
              if (key == "experimentValueResult") {
                if (
                  String(data[key].key)
                    .toLowerCase()
                    .indexOf(this.queryData.experimentValueResult.key) > -1
                ) {
                  queryList.push(data);
                }
              }
            });
          });
        } else {
          queryList = JSON.parse(JSON.stringify(this.auditList));
        }
        return queryList;
      }
    }
  },
  mounted() {
    initDicts(["EXPERIMENT_CODE", "EXPERIMENT_RESULT"], this.dicts);
    this.getList(this.basicData);
  },
  methods: {
    // 重置搜索
    clickResult() {
      this.queryData = {
        expNum: "",
        momName: "",
        experimentValueResult: {
          key: "",
          data: ""
        }
      };
    },
    // 设置单元格样式
    tableRowStyle({ row, rowIndex }) {
      if (row.experimentValueResult.key != "normal") {
        return { "background-color": "#baccef", color: "#606266" };
      }
    },
    // 回退保存
    clickRollback() {
      if (this.auditList.length == 0) {
        this.$message.error("请选择要回退的数据!");
        return;
      }
      if (this.auditFormData.experimentCheckMan == "") {
        this.$message.error("请输入回退人姓名");
        return;
      }
      this.auditList.forEach(item => {
        item.experimentResultTime = this.auditFormData.experimentResultTime;
        item.experimentCheckTime = this.auditFormData.experimentCheckTime;
        item.experimentReportTime = this.auditFormData.experimentReportTime;
        item.experimentCheckMan = this.auditFormData.experimentCheckMan;
        item.experimentReportMan = this.auditFormData.experimentReportMan;
        item.experimentResultMan = this.auditFormData.experimentResultMan;
      });
      this.auditFormData.list = this.auditList;
      DeliveryManageApi.verdictManage.rollback(this.auditFormData).then(res => {
        if (res.status == 200) {
          this.$message({
            type: "success",
            message: res.statusText
          });
          this.rollShow = false;
          this.getList(this.basicData);
        } else {
          this.$message.error(res.statusText);
        }
      });
    },
    // 点击回退
    clickRoll() {
      if (this.selectList.length == 0) {
        this.$message.error("请选择要回退的数据！");
        return;
      }
      if (this.selectList.length > 1) {
        this.$message.error("只能选择一条回退数据！");
        return;
      }
      let v = this.selectList[0];
      this.rollShow = true;
      let date =
        new Date().getFullYear().toString() +
        "-" +
        ((new Date().getMonth() + 1).toString() < 10
          ? "0" + (new Date().getMonth() + 1).toString()
          : (new Date().getMonth() + 1).toString()) +
        "-" +
        (new Date().getDate().toString() < 10
          ? "0" + new Date().getDate().toString()
          : new Date().getDate().toString());
      this.auditFormData = {
        experimentCode: "",
        experimentSwatchId: "",
        list: [],
        experimentResultMan: this.$store.state.account.user.name,
        experimentCheckMan: this.$store.state.account.user.name,
        experimentReportMan: this.$store.state.account.user.name,
        experimentResultTime: "",
        experimentCheckTime: "",
        experimentReportTime: "",
        checkReason: ""
      };
      this.auditFormData.experimentResultTime = date;
      this.auditFormData.experimentCheckTime = date;
      this.auditFormData.experimentReportTime = "";
      this.auditFormData.experimentReportMan = "";
      this.auditFormData.experimentSwatchId = v.id;
      this.auditFormData.experimentCode = v.experimentCode;
      this.auditFormData.checkReason = "";

      DeliveryManageApi.verdictManage
        .auditView({ experimentSwatchId: v.id })
        .then(res => {
          if (res.status == 200) {
            this.auditList = res.data.data;
            this.tijiaoList = res.data.data;
          } else {
            this.$message.error(res.statusText);
          }
        });
    },
    // 点击查看
    clickSeeExpValue(v) {
      this.seeShow = true;
      let sortData = [];
      for (let key in v) {
        sortData.push(v[key]);
      }
      this.seeData = this.$keysrt(sortData, "sortValue");
    },
    // 审核保存
    clickAuditSeav() {
      if (this.auditList.length == 0) {
        this.$message.error("请选择要审核的数据!");
        return;
      }
      if (this.auditFormData.experimentCheckMan == "") {
        this.$message.error("请输入审核人姓名");
        return;
      }
      this.tijiaoList.forEach(item => {
        item.experimentResultTime = this.auditFormData.experimentResultTime;
        item.experimentCheckTime = this.auditFormData.experimentCheckTime;
        item.experimentReportTime = this.auditFormData.experimentReportTime;
        item.experimentCheckMan = this.auditFormData.experimentCheckMan;
        item.experimentReportMan = this.auditFormData.experimentReportMan;
        item.experimentResultMan = this.auditFormData.experimentResultMan;
      });
      this.auditFormData.list = this.tijiaoList;
      DeliveryManageApi.verdictManage
        .conclusionSave(this.auditFormData)
        .then(res => {
          if (res.status == 200) {
            this.$message({
              type: "success",
              message: res.statusText
            });
            this.auditShow = false;
            this.getList(this.basicData);
          } else {
            this.$message.error(res.statusText);
          }
        });
    },
    // 点击审核
    clickAudit(v) {
      this.auditShow = true;
      let date =
        new Date().getFullYear().toString() +
        "-" +
        ((new Date().getMonth() + 1).toString() < 10
          ? "0" + (new Date().getMonth() + 1).toString()
          : (new Date().getMonth() + 1).toString()) +
        "-" +
        (new Date().getDate().toString() < 10
          ? "0" + new Date().getDate().toString()
          : new Date().getDate().toString());
      this.auditFormData.experimentResultTime = date;
      this.auditFormData.experimentCheckTime = date;
      this.auditFormData.experimentReportTime = date;
      this.auditFormData.experimentSwatchId = v.id;
      this.auditFormData.experimentCode = v.experimentCode;
      DeliveryManageApi.verdictManage
        .auditView({ experimentSwatchId: v.id })
        .then(res => {
          if (res.status == 200) {
            this.auditList = res.data.data;
            this.tijiaoList = res.data.data;
          } else {
            this.$message.error(res.statusText);
          }
        });
      DeliveryManageApi.verdictManage
        .auditInfo({
          experimentSwatchId: v.id
        })
        .then(res => {
          let data = res.data.data;
          let date =
            new Date().getFullYear().toString() +
            "-" +
            ((new Date().getMonth() + 1).toString() < 10
              ? "0" + (new Date().getMonth() + 1).toString()
              : (new Date().getMonth() + 1).toString()) +
            "-" +
            (new Date().getDate().toString() < 10
              ? "0" + new Date().getDate().toString()
              : new Date().getDate().toString());
          this.auditFormData.experimentResultMan = data.experimentResultMan
            ? data.experimentResultMan
            : this.$store.state.account.user.name;
          this.auditFormData.experimentCheckMan = data.experimentCheckMan
            ? data.experimentCheckMan
            : this.$store.state.account.user.name;
          this.auditFormData.experimentReportMan = data.experimentReportMan
            ? data.experimentReportMan
            : this.$store.state.account.user.name;
          this.auditFormData.experimentResultTime = data.experimentResultTime
            ? data.experimentResultTime
            : date;
          this.auditFormData.experimentCheckTime = data.experimentCheckTime
            ? data.experimentCheckTime
            : date;
          this.auditFormData.experimentReportTime = data.experimentReportTime
            ? data.experimentReportTime
            : date;
        });
    },
    // 点击同步数据按钮
    clickSetSync() {
      this.SyncShow = true;
    },
    // 获取数据
    getList(data) {
      this.loading = true;
      DeliveryManageApi.verdictManage
        .page(data)
        .then(res => {
          if (res.status === 200) {
            this.tableData = res.data.data.records;
            this.total = res.data.data.total;
          } else {
            this.$message.error(res.statusText);
          }
        })
        .finally(() => (this.loading = false));
    },
    // 选中数据操作
    selectChanage(v) {
      this.selectList = v;
    },
    // 点击分页
    handleSizeChange: function(val) {
      this.basicData.size = val;
      this.getList(this.basicData);
    },
    // 选择页码
    handleCurrentChange: function(currentPage) {
      this.basicData.current = currentPage;
      this.getList(this.basicData);
    },
    // 选择页码
    handleCurrentChange: function(currentPage) {
      this.pageIndex = currentPage;
    }
  }
};
</script>

<style lang="less">
.flex {
  display: flex;
  align-items: center;
  justify-content: center;
}

#batchquery {
  .buttom {
    width: 100%;
    .flex;
  }

  .mores {
    .flex;
    justify-content: flex-start;

    .more-title {
      font-size: 12px;
      font-family: SourceHanSansSC;
      font-weight: 400;
      color: rgb(153, 153, 153);
      font-style: normal;
      letter-spacing: 0px;
      line-height: 20px;
      text-decoration: none;
      margin-right: 1rem;
    }
  }
}
</style>
